package util;

import graph.Graph;
import graph.Shrub;
import graph.Tree;

/**
 *
 * @author Admin
 */
public class TreeColouring<V, E extends Graph.Edge<V>> extends AbstractColouring<V, E> {

    public TreeColouring(Tree<V, E> tree) {
        super(tree);
        for (V v : tree.nodes()) {
            marked.put(v, false);
        }
    }

    public void colour() {
        for (Shrub<V, E> shrub : tree.shrubs()) {
            shrub.colour();
            marked.putAll(shrub.marked);
        }
    }

    public boolean isLiec() {
        return is2aliec(tree.root());
    }
}
